<?php
// CONNECT TO DB
require('config.php');
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('<Users>' . PHP_EOL . '<Error>Error connecting to mysql!</Error>' . PHP_EOL . '</Users>');
mysql_select_db($dbname);
// DONE CONNECTING

$curTime = time();
$query = "SELECT user FROM geo_users";
$result = mysql_query($query);

echo "Updating all user times at $curTime...<br/><br/>";

while($row = mysql_fetch_assoc($result)) {
	$newTime = $curTime - rand(0, 900);
	$q = "UPDATE geo_users SET time=$newTime WHERE user='" . $row['user'] . "'";
	$r = mysql_query($q);
	if($r)
		echo $row['user'] . " updated ($newTime)! <br/>";
	else
		echo "MySQL error at " . $row['user'] . "! <br/>";
}
?>